<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
	<h3 class="sub-header" style="margin-top: 0px; padding-top: 10px;" >记录消费</h3>
	<div class="table-responsive">
		<div id="toolbar" class="btn-group">
        	<button id="btn_add" type="button" class="btn btn-info btn-sm rightSize">
            	<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> 新增
            </button>
            <button id="btn_edit" type="button" class="btn btn-info btn-sm rightSize">
                <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> 修改
            </button>
            <button id="btn_delete" type="button" class="btn btn-info btn-sm rightSize">
                <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> 删除
            </button>
        </div>
        <div class="tab-pane active">
            <div class="table-responsive">
                 <table id="recordTable"></table>
            </div>
        </div>
	</div>
<script type="text/javascript">
	var operateFormatter = function (value, row, index) {//赋予的参数
    	return [
        	'<button class="btn btn-info btn-sm rightSize detailBtn" type="button"><span class="glyphicon glyphicon-jpy" aria-hidden="true"></span> 消费</button>',
        	'<button class="btn btn-info btn-sm rightSize packageBtn" type="button" style="margin-left:2px;"><span class="glyphicon glyphicon-list-alt" aria-hidden="true"></span> 详情</button>'
    	].join('');
	}
	$(function() {
		$('#recordTable').bootstrapTable({
			url: '${mainPath}/recordtab',  
			method: "get",                     //使用get请求到服务器获取数据
	        dataType: "json",
	        contentType: 'application/json,charset=utf-8',
	        toolbar: "#toolbar2",                //一个jQuery 选择器，指明自定义的toolbar 例如:#toolbar, .toolbar.
	        uniqueId: "id",                    //每一行的唯一标识，一般为主键列
	        //height: document.body.clientHeight-165,   //动态获取高度值，可以使表格自适应页面
	        cache: false,                       // 不缓存
	        striped: true,                      // 隔行加亮
	        queryParamsType: "limit",           //设置为"undefined",可以获取pageNumber，pageSize，searchText，sortName，sortOrder 
	                                             //设置为"limit",符合 RESTFul 格式的参数,可以获取limit, offset, search, sort, order 
	        //queryParams: queryParams,
	        sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
	        sortable: true,                     //是否启用排序;意味着整个表格都会排序
	        sortName: 'name',                    // 设置默认排序为 name
	        sortOrder: "asc",                   //排序方式
	        pagination: true,                   //是否显示分页（*）
	        search: true,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
	        strictSearch: true,
	        showColumns: true,                  //是否显示所有的列
	        showRefresh: true,                  //是否显示刷新按钮
	        showToggle:true,                    //是否显示详细视图和列表视图
	        clickToSelect: true,                //是否启用点击选中行
	        minimumCountColumns: 2,          //最少允许的列数 clickToSelect: true, //是否启用点击选中行
	        pageNumber: 1,                   //初始化加载第一页，默认第一页
	        pageSize: 10,                    //每页的记录行数（*）
	        pageList: [10, 15, 20],     //可供选择的每页的行数（*）
	        paginationPreText: "<<",
	        paginationNextText: ">>",
	        paginationFirstText: "|<",
	        paginationLastText: ">|",
	        //responseHandler: responseHandler,
	        columns:[{checkbox: true},
	       	 {field:'id',title:'ID',align: 'center',width:150},
	       	{field:'mid',title:'会员编号',align: 'center', sortable:false},
	       	 {field:'mname',title:'姓名',align: 'center', sortable:false},
	       	 {field:'mphone',title:'电话',align: 'center', sortable:false},
	       	 {field:'opera',title:'消费',align: 'center', sortable:false},
	       	 {field:'balance',title:'余额',align: 'center'},
	       	{field:'cdate',title:'日期',align: 'center'},
	       	{field:'other',title:'其他',align: 'center'},
	       	 {field:'operate',title:'操作',align: 'center',valign: 'middle',formatter: operateFormatter}
	        ],
	       	onLoadSuccess: function (data) { //加载成功时执行
	        	console.log(data);
	        },
	        onLoadError: function (res) { //加载失败时执行
	            console.log(res);
	        }
            
		});
	});
</script>
<!-- </body>
</html> -->
